<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:fo="http://www.w3.org/1999/XSL/Format"
    version='1.0' >
    <xsl:template match="dishes">
        <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
            <fo:layout-master-set>
                <fo:simple-page-master master-name="content"
                page-height="8.5in" page-width="11in"
                 margin-top="0.5in" margin-bottom="0.5in"
                 margin-left="1in" margin-right="1in">
                    <fo:region-body/>
                </fo:simple-page-master>
            </fo:layout-master-set>
            <fo:page-sequence master-reference="content">
                <fo:flow flow-name="xsl-region-body">
                    <fo:table border-collapse="separate" table-layout="fixed">
                        <fo:table-column column-width="6cm"/>
                        <fo:table-column column-width="6cm"/>
                        <fo:table-column column-width="6cm"/>
                        <fo:table-body>
                            <fo:table-row>
                                <fo:table-cell column-number="1" border-color="black" border-width="0.5pt" border-style="solid">
                                    <fo:block font-weight="bold" font-size="18pt"
                                    line-height="24pt" font-family="arial"
                                     text-decoration="underline" color="blue">
                                        Dish Name
                                    </fo:block>
                                </fo:table-cell>
                                <fo:table-cell column-number="2" border-color="black" border-width="0.5pt" border-style="solid">
                                    <fo:block>Calories</fo:block>
                                </fo:table-cell>
                                <fo:table-cell column-number="3" border-color="black" border-width="0.5pt" border-style="solid">
                                    <fo:block>Image</fo:block>
                                </fo:table-cell>
                            </fo:table-row>
                            <xsl:for-each select="dish">
                                <fo:table-row>
                                    <fo:table-cell column-number="1" border-color="black" border-width="0.5pt" border-style="solid">
                                        <fo:block>
                                            <xsl:value-of select="dishName" />
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell column-number="2" border-color="black" border-width="0.5pt" border-style="solid">
                                        <fo:block>
                                            <xsl:value-of select="calories" />
                                        </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell column-number="3" border-color="black" border-width="0.5pt" border-style="solid">
                                        <fo:block>
                                            <xsl:variable name="image" select="imageURL"/>
                                            <fo:external-graphic src="url('images/dish/{$image}')"
                                                                content-height="scale-to-fit" height="2.00in"
                                                                content-width="2.00in"
                                                                scaling="non-uniform"/>
                                        </fo:block>
                                    </fo:table-cell>
                                </fo:table-row>

                            </xsl:for-each>
                        </fo:table-body>
                    </fo:table>
                </fo:flow>
            </fo:page-sequence>
        </fo:root>
        
    </xsl:template>

</xsl:stylesheet>